import {useStorage} from "@/hooks/web/useStorage";

const {getStorage, setStorage, removeStorage} = useStorage()

export const useSearchStorage = () => {
    const setSearchFlag = (key) => {
        setStorage(key + '_flag', '1')
    }

    const setSearchItem = (key, data) => {
        setStorage(key, data)
    }

    const getSearchItem = (key) => {
        return getStorage(key)
    }

    const getSearchFlag = (key) => {
        return getStorage(key + '_flag')
    }

    const removeFlag = (key) => {
        removeStorage(key + '_flag')
    }

    return {
        setSearchItem,
        getSearchItem,
        setSearchFlag,
        getSearchFlag,
        removeFlag
    }
}